<html>
<head>
	<title>db view</title>
	<meta name="decorator" content="default"/>
 %include site_media.html media_prefix=media_prefix
 
 <link href="/{{media_prefix}}/jquery-ztree/3.5.12/css/zTreeStyle/zTreeStyle.min.css" rel="stylesheet" type="text/css"/>
<script src="/{{media_prefix}}/jquery-ztree/3.5.12/js/jquery.ztree.core-3.5.min.js" type="text/javascript"></script>
	<style type="text/css">
		.ztree {margin-top:5px;*margin:-5px 0 5px -2px;_position:relative;_margin:0;_top:-10px;overflow:hidden;}
		.ztree li span.button.level0, .ztree li a.level0 {display:none;height:0;}
		.ztree li ul.level0 {padding:0;background:none;}
	</style>
	<script language="JavaScript">
		var db_tree = null;
		function onClick(event, treeId, treeNode, clickFlag) {
			if (!treeNode.isParent){
				parent.document.getElementById("db_view").src="/db_view?s="+treeNode.pId+"&db="+treeNode.id;
			}
		}
		function do_overview() {
			if (!treeNode.isParent){
				parent.document.getElementById("db_view").src="/db_view?s="+treeNode.pId+"&db="+treeNode.id;
			}
		}
		$(document).ready(function(){
			var setting = {
					view:{
						selectedMulti:false,
						nameIsHTML: true
					},
					data: {
						key: {
							title:"count"
						},
						simpleData: {
							enable: true
						}
					},
					callback: {
						onClick: onClick
					}
				};
				var zNodes= {{!all_trees}};
				// 初始化树结构
				db_tree = $.fn.zTree.init($("#db_tree"), setting, zNodes);
				db_tree.expandAll(true);
		});
	</script>
</head>
<body>
		<div class="accordion-group">
		    <div class="accordion-heading">
	         <div id="search" class="control-group" style="font-size:large; padding-top:10px; padding-left:10px">
			 	PyRedisAdmin
				<div style=" text-align:right; font-size:small; margin-right:5px; margin-top: 8px"><a href="/overview" target="db_view">{{ trans('overview') }}</a>  <a href="/auth/logout" target="_top">退出</a></div>
		     </div>
		    </div>
		    <div class="accordion-body">
				<div class="accordion-inner">
					<div id="db_tree" class="ztree"></div>
				</div>
		    </div>
		</div>
</body>
</html>